001 /*
002 * Copyright (c) 2005 Stephen J. McConnell
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
013 * implied.
014 *
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package net.dpml.component;
020
021 import java.io.IOException;
022 import java.net.URI;
023
024 /**
025 * The Controller interface defines the a contract for an object that provides generalized
026 * part loading.
027 *
028 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
029 * @version 1.0.0
030 */
031 public interface Controller
032 {
033 /**
034 * Static default controller.
035 */
036 static final Controller STANDARD = InitialContext.createController();
037
038 /**
039 * Returns the identity of the object implementing this interface.
040 * @return a uri identifying the object
041 */
042 URI getURI();
043
044 /**
045 * Create and return a new management context using the supplied directive uri.
046 *
047 * @param uri a uri identifying a deployment directive
048 * @return the management context model
049 * @exception ControlException if an error occurs
050 * @exception IOException if an I/O error occurs
051 */
052 Model createModel( URI uri ) throws ControlException, IOException;
053
054 /**
055 * Create and return a new management context using the supplied directive uri.
056 *
057 * @param composition a composition directive
058 * @return the management model
059 * @exception ControlException if an error occurs
060 * @exception IOException if an I/O error occurs
061 */
062 Model createModel( Composition composition ) throws ControlException, IOException;
063
064 /**
065 * Create and return a remote reference to a component handler.
066 * @param uri a uri identifying a deployment directive
067 * @return the component handler
068 * @exception Exception if an error occurs
069 */
070 Component createComponent( URI uri ) throws Exception;
071
072 /**
073 * Create and return a remote reference to a component handler.
074 * @param model the management context
075 * @return the component handler
076 * @exception Exception if a component construction error occurs
077 */
078 Component createComponent( Model model ) throws Exception;
079
080
081 }